#pragma once
#include<map>
#include <thread>
#define MAPMGR cMapManager::GetInstance()

struct PROCESSINFO
{
	WORD wCommond;
	WORD wType;
	HANDLE Pi;
	std::string strProcessName;
};
class cMapManager
{
	std::map<WORD, PROCESSINFO> m_RunProcessInfo;
	DWORD m_dwConnectionIndex;
public:
	GETINSTANCE(cMapManager);
	cMapManager();
	~cMapManager();
	void OpenServer(std::string StrName, WORD wCommond, WORD wType);
	void StartRunProcess(WORD wType, WORD wCommond);
	void CloseMapProcess(WORD wCommond);
	//HWND GetWindowHandleByPID(DWORD dwProcessID);
	void CloseAllMap();
	void CloseAllServer();
	void MapMsgParser(DWORD dwConnectionIndex, char* pMsg, DWORD dwLength);
	BOOL CheckRun(std::string name);
	void SendServerInfo(DWORD dwConnectIdx);
	void GetProcessInfo();
	void getProcCMD(HANDLE hproc, std::string& strCommond);
	void FistRunProcessProtect(std::string name,WORD wCommond,WORD wType,HANDLE hproc,WORD pid);
	void SendMsgAck(WORD wCommond, WORD wType);
};

